package com.example.a79273.shandianban.model;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by 79273 on 2016/9/1.
 */
public class DetailBean {

    /**
     * error_code : 0
     * error_msg : 获取信息成功
     * data : {"list":{"name":"黄伟仪","designerpic":"/Upload/Designer/237000320031/381ccb8b4b.jpg","indexpic":"/Upload/Designer/237000320031/381cbc4c40.jpg","fans":8,"isfavorited":false,"favo":8,"like":58,"hits":374,"videosurl":"","videopic":"","designerid":"237000320031","detailhtml":"","sharelink":"http://www.sdb330.com/Designer/237000320031","sharepic":"/Upload/Designer/237000320031/381cbc4c40.jpg","shareintro":"吉乐蝈品牌创始人/衫点扮时尚设计师","sharetitle":"【我是黄伟仪,衫点扮-你的毛衣新时尚】"}}
     */

    private int error_code;
    private String error_msg;
    /**
     * list : {"name":"黄伟仪","designerpic":"/Upload/Designer/237000320031/381ccb8b4b.jpg","indexpic":"/Upload/Designer/237000320031/381cbc4c40.jpg","fans":8,"isfavorited":false,"favo":8,"like":58,"hits":374,"videosurl":"","videopic":"","designerid":"237000320031","detailhtml":"","sharelink":"http://www.sdb330.com/Designer/237000320031","sharepic":"/Upload/Designer/237000320031/381cbc4c40.jpg","shareintro":"吉乐蝈品牌创始人/衫点扮时尚设计师","sharetitle":"【我是黄伟仪,衫点扮-你的毛衣新时尚】"}
     */

    private DataBean data;

    public static DetailBean objectFromData(String str) {

        return new Gson().fromJson(str, DetailBean.class);
    }

    public static DetailBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), DetailBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<DetailBean> arrayDetailBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<DetailBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<DetailBean> arrayDetailBeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<DetailBean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getError_code() {
        return error_code;
    }

    public void setError_code(int error_code) {
        this.error_code = error_code;
    }

    public String getError_msg() {
        return error_msg;
    }

    public void setError_msg(String error_msg) {
        this.error_msg = error_msg;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * name : 黄伟仪
         * designerpic : /Upload/Designer/237000320031/381ccb8b4b.jpg
         * indexpic : /Upload/Designer/237000320031/381cbc4c40.jpg
         * fans : 8
         * isfavorited : false
         * favo : 8
         * like : 58
         * hits : 374
         * videosurl :
         * videopic :
         * designerid : 237000320031
         * detailhtml :
         * sharelink : http://www.sdb330.com/Designer/237000320031
         * sharepic : /Upload/Designer/237000320031/381cbc4c40.jpg
         * shareintro : 吉乐蝈品牌创始人/衫点扮时尚设计师
         * sharetitle : 【我是黄伟仪,衫点扮-你的毛衣新时尚】
         */

        private ListBean list;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public ListBean getList() {
            return list;
        }

        public void setList(ListBean list) {
            this.list = list;
        }

        public static class ListBean {
            private String name;
            private String designerpic;
            private String indexpic;
            private int fans;
            private boolean isfavorited;
            private int favo;
            private int like;
            private int hits;
            private String videosurl;
            private String videopic;
            private String designerid;
            private String detailhtml;
            private String sharelink;
            private String sharepic;
            private String shareintro;
            private String sharetitle;

            public static ListBean objectFromData(String str) {

                return new Gson().fromJson(str, ListBean.class);
            }

            public static ListBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), ListBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<ListBean> arrayListBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<ListBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<ListBean> arrayListBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<ListBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getDesignerpic() {
                return designerpic;
            }

            public void setDesignerpic(String designerpic) {
                this.designerpic = designerpic;
            }

            public String getIndexpic() {
                return indexpic;
            }

            public void setIndexpic(String indexpic) {
                this.indexpic = indexpic;
            }

            public int getFans() {
                return fans;
            }

            public void setFans(int fans) {
                this.fans = fans;
            }

            public boolean isIsfavorited() {
                return isfavorited;
            }

            public void setIsfavorited(boolean isfavorited) {
                this.isfavorited = isfavorited;
            }

            public int getFavo() {
                return favo;
            }

            public void setFavo(int favo) {
                this.favo = favo;
            }

            public int getLike() {
                return like;
            }

            public void setLike(int like) {
                this.like = like;
            }

            public int getHits() {
                return hits;
            }

            public void setHits(int hits) {
                this.hits = hits;
            }

            public String getVideosurl() {
                return videosurl;
            }

            public void setVideosurl(String videosurl) {
                this.videosurl = videosurl;
            }

            public String getVideopic() {
                return videopic;
            }

            public void setVideopic(String videopic) {
                this.videopic = videopic;
            }

            public String getDesignerid() {
                return designerid;
            }

            public void setDesignerid(String designerid) {
                this.designerid = designerid;
            }

            public String getDetailhtml() {
                return detailhtml;
            }

            public void setDetailhtml(String detailhtml) {
                this.detailhtml = detailhtml;
            }

            public String getSharelink() {
                return sharelink;
            }

            public void setSharelink(String sharelink) {
                this.sharelink = sharelink;
            }

            public String getSharepic() {
                return sharepic;
            }

            public void setSharepic(String sharepic) {
                this.sharepic = sharepic;
            }

            public String getShareintro() {
                return shareintro;
            }

            public void setShareintro(String shareintro) {
                this.shareintro = shareintro;
            }

            public String getSharetitle() {
                return sharetitle;
            }

            public void setSharetitle(String sharetitle) {
                this.sharetitle = sharetitle;
            }
        }
    }
}
